package com.fengye.mpe.process;

import com.baomidou.mybatisplus.annotation.IdType;
import com.tangzc.autotable.annotation.ColumnComment;
import com.tangzc.autotable.annotation.mysql.MysqlCharset;
import com.tangzc.autotable.annotation.mysql.MysqlEngine;
import com.tangzc.mpe.autotable.annotation.ColumnId;
import com.tangzc.mpe.autotable.annotation.Table;
import com.tangzc.mpe.base.entity.BaseEntity;
import com.tangzc.mpe.processer.annotation.AutoDefine;
import com.tangzc.mpe.processer.annotation.AutoRepository;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * @author fengyexjtu@126.com
 * @since 2024-03-13
 */
@Data
@EqualsAndHashCode(callSuper = false)
// 指定表的编码
@MysqlCharset(charset = "utf8mb4", collate = "utf8mb4_general_ci")
// 指定表的存储引擎
@MysqlEngine("innodb")
// 指定表名、表注释、数据源、忽略字段（不参与建表）
@Table(value = "mpe_author", comment = "作者信息表", excludeProperty = {"ext"})
// 标记生成表字段定义
@AutoDefine
// 标记生成Mapper和Repository
@AutoRepository
public class Author extends BaseEntity<String, LocalDateTime> {
    
    // 字符串类型的ID，默认也是雪花算法的一串数字（MP的默认功能）
    @ColumnComment("主键")
    @ColumnId(mode = IdType.ASSIGN_ID, length = 20)
    private Long id;
    
    @ColumnComment("作者名")
    private String name;
    
    @ColumnComment("出生日期")
    private Date birthday;
    
    private String ext;
}
